package fr.gest4team.app.pilotage.dao;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;

import fr.gest4team.app.pilotage.dao.abstrait.AbstractPlanningDao;
import fr.gest4team.app.pilotage.dao.interfaces.IPlanningDao;
import fr.gest4team.app.pilotage.dto.Planning;

/**
 * Dao modifiable
 * 
 * @see fr.gest4team.app.pilotage.dto.Planning
 */
public class PlanningDao extends AbstractPlanningDao implements IPlanningDao {

	/**
	 * @author brug
	 * @return retourne la liste des Plannings.
	 */
	public List<Planning> chargerListePlanning() {
		final DetachedCriteria criteria = DetachedCriteria.forClass(Planning.class);
		return executeDetachedCriteria(criteria);
	}

	public List<Planning> chargerPlanningPour(final Integer codeActeur) {
		final String hql = "from Planning as p where p.acteur=? order by p.dateCreation desc";
		return executeHqlQuery(hql, new Object[] { codeActeur });

	}
}